import React, { FC } from 'react';
import { View, Text } from '@tarojs/components';
import { styled } from 'linaria/react';
import { useClassName } from '@/utils/index';
export interface IProps extends ICompProps {
    message: string;
    messageType:'sys'|'order'|'interact';
}
MessageContent.defaultProps = {} as Partial<IProps>;
function MessageContent(props: IProps) {
    const { className, style, messageType, message } = props;
    const localClassName = useClassName('MessageContent', className);
    const currentName = (messageType:'sys'|'order'|'interact')=>{
        let name=null;
        switch(messageType){
            case 'sys':
            name = '系统消息';
            break;
            case 'order':
            name = '订单消息';
            break;
            default:
            name = '互动消息';
        }
        return name;
    }
    return (
        <RootView className={localClassName} style={style}>
            <View className="name">{currentName(messageType)}</View>
            <View className="message">{message}</View>
        </RootView>
    );
}
export default React.memo(MessageContent as FC<IProps>);
const RootView = styled(View)`
    &.MessageContent {
        width: 542px;
        height: 100%;
        .name {
            font-size: 32px;
            font-weight: 500;
            color: #333333;
        }
        .message {
            font-size: 26px;
            font-weight: 400;
            color: #808a9d;
            width: 100%;
            overflow: hidden; /*超出隐藏*/
            text-overflow: ellipsis; /*隐藏后添加省略号*/
            white-space: nowrap; /*强制不换行*/
        }
    }
`;
